home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr37 / regreq.zip / MISCFN.LIB < prev    next >
Text File  |  1995-03-20  |  3KB  |  105 lines

  1. DECLARE FUNCTION DateDiff(DATE Date1, DATE Date2) INTEGER
  2. DECLARE FUNCTION GetCfgLine(INTEGER fhdl) STRING
  3. DECLARE FUNCTION GetLangText() STRING
  4. DECLARE FUNCTION GetLangExt() STRING
  5.  
  6. ;--------------------------------------------------------------------------
  7. FUNCTION DateDiff(DATE Date1, DATE Date2) INTEGER
  8.  
  9.    ' Function returns the number of days difference between Date1 and date2
  10.    ' as an integer
  11.  
  12.         DateDiff=ABS(Date1-Date2)
  13. ENDFUNC
  14.  
  15. ;-------------------------------------------------------------------------
  16.  
  17. FUNCTION GetCfgLine(INTEGER fhdl) STRING
  18.  
  19.    'Function Reads a line from a file open on channel fhdl and returns
  20.    'the string. All blank lines and lines beginning with a semi-colon
  21.    'are considered remarks and are ignored. Returns an empty string
  22.    ' if an error or the EOF are reached
  23.  
  24. BOOLEAN ErrFlag
  25. STRING CfgRdLine
  26.  
  27.  
  28. LET ErrFlag=FALSE
  29. CfgRdLine=""
  30.  
  31. WHILE (!ErrFlag) DO
  32.         FGET fhdl, CfgRdLine
  33.         If (FERR(fhdl)) THEN
  34.                 ErrFlag=True
  35.                 BREAK
  36.         ENDIF
  37.  
  38. IF ((TRIM(CfgRdLine," ")="")|(LEFT(CfgRdLine,1)=";")) CONTINUE
  39. BREAK
  40. ENDWHILE
  41.  
  42. IF (ErrFlag=TRUE) LET CfgRdLine=""
  43.  
  44. GetCfgLine=CfgRdLine
  45.  
  46. ENDFUNC
  47.  
  48. ;-------------------------------------------------------------------------
  49.  
  50. FUNCTION GetLangText() STRING
  51.  
  52.         'Function returns the drive, path, name and extension of the
  53.         'PCBTEXT file in use by the current caller.
  54.  
  55. STRING PathToSys,LocOfText,ExtOfText
  56. INTEGER fhl
  57.  
  58.         PathToSys=GETENV("PCBDRIVE")+GETENV("PCBDIR")+"\PCBOARD.SYS"
  59.         LocOfText=READLINE(PCBDAT(),27)+"PCBTEXT"
  60.         IF (READLINE(PCBDAT(),74)=FALSE) THEN
  61.                 GetLangText=LocOfText
  62.                 Goto OutOfFunc
  63.         ENDIF
  64.         fhl=FNEXT()
  65.         FOPEN fhl,PathToSys,O_RD,S_DN
  66.         FSEEK fhl, 80, SEEK_SET
  67.         FREAD fhl, ExtOfText, 4
  68.         FCLOSE fhl
  69.         LocOfText=TRIM(LocOfText+ExtOfText," ")
  70.         IF (RIGHT(LocOfText,1)=".") LocOfText=TRIM(LocOfText,".")
  71.         GetLangText=LocOfText
  72.  
  73. :OutOfFunc
  74. ENDFUNC
  75.  
  76. ;-------------------------------------------------------------------------
  77.  
  78. FUNCTION GetLangExt() STRING
  79.  
  80.         'Function returns the Language Extension of the
  81.         'PCBTEXT file in use by the current caller.
  82.  
  83. STRING PathToSys,ExtOfText
  84. INTEGER fhl
  85.  
  86.         PathToSys=GETENV("PCBDRIVE")+GETENV("PCBDIR")+"\PCBOARD.SYS"
  87.         IF (READLINE(PCBDAT(),74)=FALSE) THEN
  88.                 GetLangExt=""
  89.                 Goto OutOfFunc
  90.         ENDIF
  91.         fhl=FNEXT()
  92.         FOPEN fhl,PathToSys,O_RD,S_DN
  93.         FSEEK fhl, 80, SEEK_SET
  94.         FREAD fhl, ExtOfText, 4
  95.         FCLOSE fhl
  96.         ExtOfText=TRIM(ExtOfText," ")
  97.         IF (LEFT(ExtOfText,1)=".") ExtOfText=""
  98.         GetLangExt=ExtOfText
  99.  
  100. :OutOfFunc
  101. ENDFUNC
  102.  
  103.  
  104.  
  105. ;-------------------------------------------------------------------------